Skip to main content

mobileCurrentLocation

Type

function

Summary

Returns the current location of the device.

Syntax

mobileCurrentLocation()

Description

Use the mobileCurrentLocation function to find the current location of the device.

Use the mobileCurrentLocation function to find the current location of the device. If location tracking has not been enabled this function returns empty. Otherwise it returns an array.

note

: Before using the mobileCurrentLocation function, the mobileSensorAvailable function should first be called with the line:

    mobileSensorAvailable(\"location\")

Doing this will request the necessary permissions for using location sensors.

Examples

put mobileCurrentLocation() into theLocation

Value

NameTypeDescription

return

array

If location tracking has been enabled the mobileCurrentLocation function returns an array with the following keys

  • "horizontal accuracy": the maximum error in meters of the position indicated by longitude and latitude
  • "latitude": the latitude of the current location, measured in degrees relative to the equator. Positive values indicate positions in the Northern Hemisphere, negative values in the Southern.
  • "longitude": the longitude of the current location, measured in degrees relative to the zero meridian. Positive values extend east of the meridian, negative values extend west.
  • "vertical accuracy": the maximum error in meters of the altitude value.
  • "altitude": the distance in meters of the height of the device relative to sea level. Positive values extend upward of sea:level, negative values downward.
  • "timestamp": the time at which the measurement was taken, in seconds since 1970.

If the latitude and longitude could not be measured, those keys together with the horizontal accuracy key will not be present. If the altitude could not be measured, that key together with the vertical accuracy will not be present.

If location tracking has not been enabled the mobileCurrentLocation function returns empty

command: mobileStopTrackingSensor, mobileStartTrackingSensor

function: mobileSensorAvailable, mobileSensorReading

message: trackingError, locationChanged

Compatibility and Support

Introduced

LiveCode 4.5.2

OS

ios

android

Platforms

mobile

Thank you for your feedback!

Was this page helpful?